// TODO: this is the same as app/templates/core/components/page-errors.pug, but original Backbone version; can we merge them?
#loading-error.text-center
  if !jqxhr
    h1(data-i18n="loading_error.unknown")

  else if jqxhr.status === 401
    h1
      span.spr 401:
      span(data-i18n="loading_error.login_required")
    p(data-i18n="loading_error.login_required_desc")
    button.login-btn.btn.btn-primary(data-i18n="login.log_in")
    button#create-account-btn.btn.btn-primary(data-i18n="login.sign_up")

    // 402 currently not in use. TODO: Set it up
  else if jqxhr.status === 402
    h2 402: Payment Required

  else if jqxhr.status === 403
    h1
      span.spr 403:
      span(data-i18n="loading_error.forbidden") Forbidden
    p(data-i18n="loading_error.forbidden_desc")

    // this should make no diff... but sometimes the server returns 403 when it should return 401
    if !me.isAnonymous()
      button#logout-btn.btn.btn-primary(data-i18n="login.log_out")

  else if jqxhr.status === 404
    h1
      span.spr 404:
      span(data-i18n="loading_error.not_found")
    p(data-i18n="loading_error.not_found_desc")

  else if !jqxhr.status
    h1(data-i18n="loading_error.connection_failure")
    p(data-i18n="loading_error.connection_failure_desc")

  else
    if jqxhr.status === 408
      h1
        span.spr 408:
        span(data-i18n="loading_error.timeout")
    else if jqxhr.status >= 500 && jqxhr.status <= 599
      h1
        span.spr #{jqxhr.status}:
        span(data-i18n="loading_error.server_error")
    else
      h1(data-i18n="loading_error.unknown")

    p(data-i18n="loading_error.general_desc")

  p
    a(href="/" data-i18n="nav.home")
    span= " | "
    a(href="/about" data-i18n="nav.about")
    if !features.china
      span= " | "
      a(href="https://codecombat.zendesk.com/hc/en-us" target="_blank" data-i18n="contact.faq")
    if !me.isStudent()
      span= " | "
      a.contact-modal(data-i18n="nav.contact")

  - var num = Math.floor(Math.random() * 3) + 1;
  img#not-found-img(src='/images/pages/not_found/404_' + num + '.png')
